﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QExcel
{
    public class QCountRow : QBaseRow
    {
        public QCountRow()
        {
        }

        public override string Name
        {
            get
            {
                return "QCountRow";
            }
            set
            {

            }
        }

        private string countText = "统计";
        public string CountText
        {
            get
            {
                return countText;
            }

            set
            {
                countText = value;
            }
        }

        private int sumCount = 1;
        /// <summary>
        /// 汇总行所要汇总的总行数
        /// </summary>
        public int SumCount
        {
            get
            {
                return sumCount;
            }
            set
            {
                sumCount = value;
            }
        }

        public QCountRow(int count)
        {
            this.sumCount = count;
        }

        public override object GetValue(QColumn col)
        {
            if (col.IsCount)
            {
                return string.Format("=SUBTOTAL(9,R[-{0}]C:R[-1]C)", sumCount);
            }
            return string.Empty;
        }
    }
}
